Skip to main content

Smart Contract Endpoints

Get Contract

Returns metadata about a specific smart contract deployed on a given blockchain. This is typically used to inspect the contract address, deployment information, version, and VM/runtime details.

Request

GET /blockchains/{blockchainId}/contracts/{address}

For a node running on https://tn-w-1.uledger.net/, the full URL is:
https://tn-w-1.uledger.net//blockchains/{blockchainId}/contracts/{address}

Path parameters

  • blockchainId – The blockchain identifier (one of the values returned by GET /blockchains).
  • address – The on-chain contract address to inspect.

Response

The response contains contract metadata. Exact fields depend on the node and VM configuration, but commonly include:

  • blockchainId – ID of the blockchain where the contract is deployed.
  • address – Contract address.
  • creator – Address that deployed the contract (if tracked).
  • deploymentTxId – Transaction ID that created the contract.
  • codeHash – Hash of the contract code or artifact.
  • vmType – Contract VM/runtime type.
  • version – Contract version, if versioning is enabled.
  • status – Current contract status (e.g. ACTIVE, PAUSED, UPGRADED).
  • metadata – Optional additional metadata defined by your deployment.

Example response

{

"blockchainId": "{blockchainId}",
"address": "{contractAddress}",
"creator": "{creatorAddress}",
"deploymentTxId": "{deploymentTransactionId}",
"codeHash": "c5b21c4e8f6c4d7e8f3d...",
"vmType": "uledgervm-v1",
"version": 3,
"status": "ACTIVE",
"metadata": {
"name": "ExampleContract",
"description": "Demo contract used for documentation",
"tags": ["demo", "test"]
}
}
curl -X GET -L "https://tn-w-1.uledger.net//blockchains/{blockchainId}/contracts/{address}" | jq

Get Contract State

Returns the current state snapshot of a smart contract on a given blockchain. The structure of the state is contract-defined and typically exposed as a JSON object or key–value map.

Request

GET /blockchains/{blockchainId}/contracts/{address}/state

For a node running on http://my.node1.uledger.io, the full URL is:
http://my.node1.uledger.io/blockchains/{blockchainId}/contracts/{address}/state

Path parameters

  • blockchainId – The blockchain identifier.
  • address – The contract address whose state you want to inspect.

Response

The response contains the latest on-chain state for the contract. The exact shape is determined by the contract, but a typical pattern is:

  • blockchainId – ID of the chain where the contract lives.
  • address – Contract address.
  • version – Current contract state/version number.
  • state – JSON object representing the contract's state.

Example response

{

"blockchainId": "{blockchainId}",
"address": "{contractAddress}",
"version": 3,
"state": {
"owner": "{ownerAddress}",
"totalSupply": "1000000",
"balances": {
"{ownerAddress}": "750000",
"{otherAddress}": "250000"
},
"paused": false
}
}
curl -X GET -L "http://my.node1.uledger.io/blockchains/{blockchainId}/contracts/{address}/state" | jq

Get Contract Trace / Logs

Returns the execution trace or logs for a specific contract call, identified by the transaction that invoked the contract. This is useful for debugging and observing emitted events.

Request

GET /blockchains/{blockchainId}/contracts/{address}/trace/{transactionId}

For a node running on http://my.node1.uledger.io, the full URL is:
http://my.node1.uledger.io/blockchains/{blockchainId}/contracts/{address}/trace/{transactionId}

Path parameters

  • blockchainId – The blockchain identifier.
  • address – Contract address that handled the transaction.
  • transactionId – The transaction whose contract execution trace you want.

Response

The response format depends on your node configuration, but a typical structure is:

  • blockchainId, address, transactionId – Context of the trace.
  • events – Array of contract events/log entries emitted during execution.
  • trace – Optional low-level execution trace information.

Example response

{

"blockchainId": "{blockchainId}",
"address": "{contractAddress}",
"transactionId": "{transactionId}",
"events": [
{
"name": "Transfer",
"timestamp": "2025-11-11T20:25:01Z",
"indexedArgs": {
"from": "{fromAddress}",
"to": "{toAddress}"
},
"data": {
"amount": "1000"
}
},
{
"name": "BalanceUpdated",
"timestamp": "2025-11-11T20:25:01Z",
"data": {
"owner": "{toAddress}",
"newBalance": "26000"
}
}
],
"trace": {
"steps": 42,
"gasUsed": 12345
}
}
curl -X GET -L "http://my.node1.uledger.io/blockchains/{blockchainId}/contracts/{address}/trace/{transactionId}" | jq